<script lang='ts'>
import { defineComponent, onMounted, createApp, ref, ComponentPublicInstance } from 'vue'
import Son from './Son.vue'
export default defineComponent({
  components: {
    Son
  },
  setup () {
    const sonRef = ref<ComponentPublicInstance | null>(null)
    onMounted(() => {
      const div = document.createElement('div')
      const sonNode = createApp(Son).mount(div)
      document.querySelector('#sonId')!.innerHTML = sonNode.$el.innerHTML
      if (sonRef.value)
        console.log(sonRef.value.$el)
    })
    return {
      sonRef
    }
  }
})
</script>
<template>
  <div>
    <Son v-show="false" ref="sonRef">12</Son>我是Parent
    <div id="sonId"></div>
  </div>
</template>
<style lang='scss' scoped>
</style>
